package com.wyx.suanfa;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class mergeTwoLists {
    //将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。
    public static void main(String[] args) {


    }
}
/*
* /**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }

class Solution {
    public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
        if(list1 == null || list2 == null){
            return list1 == null? list2 : list1;
        }
        ListNode ret = new ListNode();
        ListNode temp = ret;
        ListNode aCur = list1;
        ListNode bCur = list2;
        while(aCur != null && bCur != null){
            if(aCur.val <= bCur.val){
                temp.next = aCur;
                aCur = aCur.next;
            }else{
                temp.next = bCur;
                bCur = bCur.next;
            }
            temp = temp.next;
        }

        temp.next = aCur == null? bCur : aCur;
        return ret.next;
    }
}*/